use Mojo::mysql;
use strict;

my $mysql = Mojo::mysql->strict_mode('mysql://dahama:xxxxxxxxxx@/vpninfo');

my $db = $mysql->db;

sub show_nopermit {
    my $mac_nopermit = $db->query('select * from maclist where guanliyuanshenhe=2 and datediff(shijian,now())<=0 and datediff(shijian,now())>-2')->hashes;
    my $account_nopermit = $db->query('select * from vpn_account where guanliyuanshenhe=2 and datediff(shijian,now())<=0 and datediff(shijian,now())>-2')->hashes;
    print "$mac_nopermit->[0]->{mac}\n"; #mojo render
    print "$account_nopermit->[0]->{username}\n"; #mojo render
}

sub show_nodeal {
    my $mac_nodeal = $db->query('select * from maclist where guanliyuanshenhe=0')->hashes;
    my $account_nodeal = $db->query('select * from vpn_account where guanliyuanshenhe=0')->hashes;
    print $mac_nodeal->[0]->{mac},"\n"; #mojo render
    print $account_nodeal->[0]->{username},"\n"; #mojo render
}

sub show_dealed {
    my $mac_dealed = $db->query('select * from maclist where xitongchuli=1')->hashes;
    my $account_dealed = $db->query('select * from vpn_account where xitongchuli=1')->hashes;
    print $mac_dealed->[0]->{mac},"\n"; #mojo render
    print $account_dealed->[0]->{username},"\n"; #mojo render
}